//线段树-数学(求最大公约数)
//可以直接维护最大公约数的信息, gcd(p) = gcd(lc, rc);
//但是区间修改懒不下来, 也无法进行剪枝
//数学结论: gcd(a1, a2,... an) = gcd(a1, a2 - a1, ..., an - an-1), 原始数列的gcd就等于差分序列的gcd
//区间修改: [l, r] + d  ---> l + d, r+1 - d
//区间查询: [al, al+1, ... ar] ---> [al, al+1 - al, ... ar-ar-1] => gcd(al, gcd(l+1, r))
//还需要维护原始数列的al, 但其实就等于差分序列的[1, l]区间和, 因此直接维护差分序列的sum即可

#include <iostream>
using namespace std;
const int N = 5e5 + 10;
typedef long long ll;
ll a[N]; //差分数组
int n, m;
#define lc p << 1
#define rc p << 1 | 1

struct node
{
    int l, r;
    ll sum, gcd; //区间和、最大公约数
}tr[N << 2];

ll gcd(ll a, ll b)
{
    if(b == 0) return a;
    return gcd(b, a % b);
}

void pushup(int p)
{
    tr[p].sum = tr[lc].sum + tr[rc].sum;
    tr[p].gcd = gcd(tr[lc].gcd, tr[rc].gcd);
}

void build(int p, int l, int r)
{
    tr[p] = {l, r, a[l], a[l]};
    if(l == r) return;
    int mid = (l + r) >> 1;
    build(lc, l, mid); build(rc, mid + 1, r);
    pushup(p);
}

//单点修改
void modify(int p, int x, ll k)
{
    int l = tr[p].l, r = tr[p].r;
    if(l == r) 
    {
        tr[p].sum += k;
        tr[p].gcd += k;
        return; 
    }
    int mid = (l + r) >> 1;
    if(x <= mid) modify(lc, x, k);
    else modify(rc, x, k);
    pushup(p);
}

//查询区间和
ll query1(int p, int x, int y)
{
    int l = tr[p].l, r = tr[p].r;
    if(x <= l && r <= y) return tr[p].sum;
    int mid = (l + r) >> 1;
    ll sum = 0;
    if(x <= mid) sum += query1(lc, x, y);
    if(y > mid) sum += query1(rc, x, y);
    return sum;
}

//查询最大公约数
ll query2(int p, int x, int y)
{
    int l = tr[p].l, r = tr[p].r;
    if(x <= l && r <= y) return tr[p].gcd;
    int mid = (l + r) >> 1;
    ll ret = 0;
    if(x <= mid) ret = gcd(ret, query2(lc, x, y));
    if(y > mid) ret = gcd(ret, query2(rc, x, y));
    return ret;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++) 
    {
        ll x; cin >> x; 
        a[i] += x, a[i + 1] -= x;
    }
    build(1, 1, n);
    while(m--)
    {
        char op;
        int l, r;
        cin >> op >> l >> r;
        if(op == 'C')
        {
            ll d; cin >> d;
            modify(1, l, d); 
            if(r + 1 <= n) modify(1, r + 1, -d);
        }
        else
        {
            ll sum = query1(1, 1, l);
            ll g = 0;
            if(l + 1 <= r) 
                g = query2(1, l + 1, r);
            cout << abs(gcd(sum, g)) << endl;
        }
    }
    return 0;
}